import cv2
import os
from os.path import join
from fnmatch import filter

def pic_compare():
    Compare1_dir = r'/home/ubuntu/12TB/YYT/meta-ablation/results/Real_DID_ResNet_lr1e-4/test_latest/images'
    Compare2_dir = r'/home/ubuntu/12TB/YYT/meta-ablation/results/Real_Rain800_ResNet_lr1e-4/test_latest/images'
    Compare3_dir = r'/home/ubuntu/12TB/YYT/meta-ablation/results/Real_Rain1400_ResNet_lr1e-4/test_latest/images'
    saveroot = r'/home/ubuntu/12TB/YYT/meta-ablation/ExperResults/differentData'
    os.makedirs(saveroot, exist_ok=True)
    name_list = os.listdir(Compare1_dir)
    name_list = filter(name_list, '*_pred_Bs.png')
    for i in range(len(name_list)):
        # name_list[i] = name_list[i].replace('_pred_pred_Bt.png','')
        img1 = cv2.imread(join(Compare1_dir,name_list[i]))
        img2 = cv2.imread(join(Compare2_dir,name_list[i]))
        img3 = cv2.imread(join(Compare3_dir,name_list[i]))
        target = cv2.hconcat([img1,img2,img3])
        cv2.imwrite(join(saveroot, name_list[i]), target)
        # cv2.imshow('compare', target)
        # cv2.waitKey()


pic_compare()


